<!-- 引入头部 -->
<include file="header" />
<link rel="stylesheet" href="__PUBLIC__/css/admin/index.css">
<script type="application/javascript" src="__PUBLIC__/js/home/index.js"></script>
<style type="text/css">
body {
    font-size: 13px;
}
</style>
<!--  引入UEditor  -->

<!-- 配置文件 -->
<script type="text/javascript" src="__PUBLIC__/ueditor_sae/ueditor.config.js"></script>
<!-- 编辑器源码文件 -->
<script type="text/javascript" src="__PUBLIC__/ueditor_sae/ueditor.all.js"></script>
<!--建议手动加载语言，避免在ie下有时因为加载语言失败导致编辑器加载失败-->
<!--这里加载的语言文件会覆盖你在配置项目里添加的语言类型，比如你在配置项目里配置的是英文，这里加载的中文，那最后就是中文-->
<script type="text/javascript" charset="utf-8" src="__PUBLIC__/ueditor_sae/lang/zh-cn/zh-cn.js"></script>

<!-- 实例化编辑器 -->
<script type="text/javascript">
    var ue = UE.getEditor('container');
    
    function gbcount(message, total, used, remain) {
        var max;
        var userSpan = document.getElementById(used);
        var totalSpan = document.getElementById(total);
        var remainSpan = document.getElementById(remain);
        max = totalSpan.innerHTML;
        if (message.value.length > max) {
            message.value = message.value.substring(0, max);
            //used.value = max;
            //remain.value = 0;
            userSpan.innerHTML=max;
            remainSpan.innerHTML=0;
            //alert("信息内容不能超过 120 个字!");
            // 设置摘要输入框为红色，提交按钮变为不可用
            //var zy = document.getElementById("zhaiyao");
            $("#zhaiyao").addClass("has-error");
            $("#submitId").attr("disabled", true);
        } else {

            userSpan.innerHTML = message.value.length;
            remainSpan.innerHTML = max - userSpan.innerHTML;
            // 设置摘要输入框的红色，提交按钮变为可用
            $("#zhaiyao").removeClass("has-error");
            $("#submitId").attr("disabled", false);
        }
    }

    function checkForm() {
        // 有空再写校验
        return true;
    }
</script>

<body>


<div class="container-fluid">

<!-- 首先屏幕分为2列 -->
<div class="row">
<!--    左则的菜单栏 -->
   <include file="left" />

    <!-- 如果是中大屏幕则分为2列，在小屏幕就显示一列 -->
    <div class="col-md-10 col-sm-10 col-xs-12">
        <div class="panel panel-default">
          <div class="panel-heading" style="height:40px;">
              <div class="row">
                  <div class="col-sm-3 my-breadcrumb"><span class="">文章 > 发表文章</span></div>
                  <div class="col-sm-2 col-sm-offset-7">
                      <a class="btn btn-info active " style="padding:4px 8px;" href="{:U('Home/Index/index')}">
                        返回文章列表
                      </a>
                  </div>
              </div>
          </div>
        </div>


        <div class="main-content">
        <!--{:$ct['id']}-->
            <form name="addArt" id="addArt" method="post"
                  class="form-horizontal" role="form" onsubmit="return checkForm();">
                <input type="hidden" name="id" id="id" value="{:$ct['id']}">
              <div class="form-group">
                <label for="inputEmail3" class="col-sm-2 control-label">标题<font color="red"> *</font></label>
                <div class="col-sm-10">
                  <input type="text" class="form-control" id="title" name="title"
                         value = "{:$ct['title']}" placeholder="请输入文章标题">
                </div>
              </div>
              <div class="form-group">
                <label for="inputEmail3" class="col-sm-2 control-label">文章类型<font color="red"> *</font></label>
                <div class="col-sm-4">
                  <select class="form-control" name="cont_type">
                      <volist name="typeList" id="vo">
                          <option value="{$vo.type_no}" <if condition="$vo['type_no'] eq $ct['cont_type']">selected="selected"</if> >{$vo.type_name}</option>
                      </volist>
                    </select>
                </div>
              </div>
              <div class="form-group" id="zhaiyao">
                <label for="inputEmail3" class="col-sm-2 control-label">文章摘要<font color="red"> *</font></label>
                <div class="col-sm-10">
                    <input type="text" class="form-control" id="title" name="ctt_summary"
                         value = "{:$ct['ctt_summary']}" placeholder="请输入文章摘要，不超过120个字。"
                           onkeydown="gbcount(document.addArt.ctt_summary,'total','used','remain');"
                           onkeyup="gbcount(document.addArt.ctt_summary,'total','used','remain');">
                    <span id="helpBlock" class="help-block">
                       摘要最多字数：<span name="total" id="total" value="120">120</span>
					    已经输入字数：<span name="used" id="used" value="0">0</span>
	                   剩余字数：<span name="remain" id="remain"  value="0">120</span>
                </div>
              </div>
              <div class="form-group">
                <label for="inputPassword3" class="col-sm-2 control-label">内容</label>
                <div class="col-sm-10">
                  <!-- 加载编辑器的容器 -->
                    <script id="container" name="content" type="text/plain">
                        {$ct['content']|htmlspecialchars_decode}
                    </script>
                    <div>
                        为了在小屏幕的设备上保持图片的比例请在插入图片的HTML代码上一个属性：
                        <font color="red">class="img-responsive"</font> <br>
                        比如:&lt;img class="img-responsive" src="1419347160195971.jpg" title="" alt="" /&gt;
                    </div>
                </div>
              </div>

              <div class="form-group container">
               <div class="col-sm-offset-4 col-sm-8">
                  <button type="submit" class="btn btn-info" id="submitId">保存</button>
                   &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                  <button type="reset" id="emptyContent" class="col-xs-offset-3 col-sm-offset-2 col-md-offset-2 col-lg-offset-2 btn btn-default">清空内容</button>
                </div>
              </div>
            </form>

        </div> <!-- main-content -->
</div>

</div>  <!-- /row -->

</div> <!-- /container -->

</body>

<!-- 引入尾部 -->
<include file="footer" />
